<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>学生实习首页</title>
		<link rel="stylesheet" type="text/css" href="../../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/base.css">
			<link rel="stylesheet" type="text/css" href="../../css/news.css">
		<style>
			body {
			}
            .rotation-img {
			    width: 100%;
			    height: 190px;
			    background-image: url(image/course_placehoder.png);
			    background-size: 100% 100%;
			    display: block;
             }
			.base_left_item {
				position: fixed;
				top: 22px;
				left: 0;
				z-index: 10;
			}
			.base_back_icon {
				height: 30px;
				position: absolute;
				top: 7px;
				left: 7px;
				margin-top: 0;
			}
			.imgSet {
				width: 42px;
				height: 42px;
			}
			.spanstyle {
				text-align: center;
			}
			.div_buton {
				width: 20%;
				height: 80px;
				text-align: center;
				margin-top: 10px;
				float: left;
			}
			.img_width {
				width: 14px;
				position: relative;
				top: 2px;
			}
			.padding_left5 {
				padding-left: 5px;
			}
           .divstyle{
			   padding-left: 10px;
			   padding-right: 10px;
		      
		       line-height: 40px;
			}
				.train-title {
			    overflow: hidden;
			    text-overflow: ellipsis;
			    display: -webkit-box;
			     -webkit-line-clamp: 4;
			    -webkit-box-orient: vertical;
			    padding-right: 10px;
         }
		</style>
	</head>
	<body>
		<div id="main" style="background-color: #f3f5f7;"  hidden="hidden">
			<a class="base_left_item" href="#" onclick="backClick()"> <img class="base_back_icon" src="../../image/icon_bgback.png" alt=""> </a>
			<!-- 轮播图 -->
			<div id="train_slider" class="mui-slider rotation-div" >
				<div id="rotation" class="mui-slider-group mui-slider-loop"></div>
				<div id="noRotation"  hidden="hidden">
					<div class="rotation-cell">
						<a href="#" style="    display: block;"> <img class="rotation-img" src="../../image/firstNewsTitls2.png"> </a>
					</div>
				</div>
				<div id="pageControl" class="mui-slider-indicator"></div>
			</div>
			<div  style="width: 100%;height: 180px; background-color: #FFFFFF;" class="clearfix">
			<div class="div_buton" id="qiandao">
					<img src="../../image/icon_qiandao.png" class="imgSet" />
					<div class="font13 base_black_grey ">
						签到
					</div>
				</div>
				<div class="div_buton" id="tijiaoDaily">
					<img src="../../image/icon_ribao-.png" class="imgSet" />
					<div class="font13 base_black_grey ">
						日报
					</div>
				</div>
				<div class="div_buton" id="tijiaoweekly">
					<img src="../../image/icon004.png" class="imgSet" />
					<div class="font13 base_black_grey ">
						周报
					</div>
				</div>
				<div class="div_buton" id="tijiaomonth">
					<img src="../../image/icon-yuebao.png" class="imgSet" />
					<div class="font13 base_black_grey ">
						月报
					</div>
				</div>
				<div class="div_buton" id="jieye">
					<img src="../../image/pingfen001.png" class="imgSet" />
					<div class="font13 base_black_grey ">
						报告
					</div>
				</div>
				<div class="div_buton" id="learnid">
						<img src="../../image/icon_xuexi.png" class="imgSet" />
						<div class="font13 base_black_grey ">
							学习
						</div>
					</div>
					<div class="div_buton" id="testid">
						<img src="../../image/icon_test.png" class="imgSet" />
						<div class="font13 base_black_grey ">
							考核
						</div>
					</div>
				</div>
					<div class="divstyle bgcolor ">
					<img src="../../image/icon_measurement.png"  class="img_width"/><samp class="base_dark_grey base_content_font padding_left5">我的测评</samp>
					
				</div>
				<ul class="mui-table-view" id="div_news" >
				<!--<li class="mui-table-view-cell train-cell">
					<img class="hot-train-image" src="../../image/course_placehoder.png">
					<div class="hot-train-title-div">
						<p class="base_black_grey base_content_font train-title">
							就业推荐 汇聚各路英才
							就业推荐 汇聚各路英才
							就业推荐 汇聚各路英才
							就业推荐 汇聚各路英才
						</p>
						<p class="base_grey base_tag_font hot-train-time">
							2017-09-10
						</p>
					</div>
				</li>
				<li class="mui-table-view-cell train-cell">
					<img class="hot-train-image" src="../../image/course_placehoder.png">
					<div class="hot-train-title-div">
						<p class="base_black_grey base_content_font train-title">
							就业推荐 汇聚各路英才
							就业推荐 汇聚各路英才
							就业推荐 汇聚各路英才
							就业推荐 汇聚各路英才
						</p>
						<p class="base_grey base_tag_font hot-train-time">
							2017-09-10
						</p>
					</div>
				</li> -->
				</ul>
			</div>
		    <div class="noSign"   id="noData"  hidden="hidden">
              <img src="./image/icon_nodata.png" width="60%">
              <p class="font16 top_15 base_dark_grey" >
                暂无数据
              </p>
            </div>
            <div class="loadFailure" hidden="hidden" id="noNet">
              <img src="./image/icon_nonet.png" width="60%">
              <p class="" >
                数据加载失败
              </p>
              <p>
                请检查您的网络
              </p>
              <button type="button" class="mui-btn mui-btn-outlined" onclick="loaddata()">
                重新加载
              </button>
          </div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/jquery.min.js"></script>
	<script type="text/javascript" src="../../script/mui.min.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript">
		var rotationArr = new Array();
		//轮播图数据
		apiready = function() {
		   loaddata();
		   onclickwin();
		   addListener();
		   customUI();
		   SendBehaviorTrajectoriesNotifi1('0', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
		};
		
		
		function backClick(){
		 SendBehaviorTrajectoriesNotifi1('1', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
		api.closeWin({
        });
		}
		
		function addListener(){
		   api.addEventListener({
				name : 'RefreshPracticeNotifi'
			}, function(ret, err) {
				 loaddata();
			});
		}
		//加载数据
			function loaddata() {
			   showProgress();
				var params = {
					uid : $api.getStorage('cfnetppuid'),
					jid : $api.getStorage('cfnetppjxid'),
					usertype : 0
				};
				cfnetppPOST(url_trainIndex, params, true, function(data, status) {
				   api.hideProgress();
					if (status == 'success') {
						if (data.code == 200) {
							$('#main').show();
							var list = data.data;
							rotationArr = list.shouye;
							setupRotationData();
							news(list.zixun,list.zixun.length);
						} else {
							$('#main').hide();
							$('#noData').show();
							$('#noNet').hide();
						}
					} else {
						$('#main').hide();
						$('#noData').show();
						$('#noNet').hide();
					}
				})
			}
		//设置轮播图数据
		function setupRotationData() {
			if (rotationArr.length == 1) {
				var rotationHtml = '';
				rotationHtml = noRotationHtmlString(0, rotationArr[0]);
				$('#noRotation').html(rotationHtml);
				$('#noRotation').show();
				$('#rotation').hide();
			} else {
				var rotationHtml = '';
				//额外增加的一个节点(循环轮播：第一个节点是最后一张轮播)
				var lastIndex = rotationArr.length - 1;
				var rotationLastData = rotationArr[lastIndex];
				rotationHtml += firstLastImgHtml(lastIndex, rotationLastData);
				//遍历数组
				for (var i = 0; i < rotationArr.length; i++) {
					var rotationData = rotationArr[i];
					rotationHtml += rotationHtmlString(i, rotationData);
				}
				//额外增加的一个节点(循环轮播：最后一个节点是第一张轮播)
				var firstIndex = 0;
				var rotationFirstData = rotationArr[firstIndex];
				rotationHtml += firstLastImgHtml(firstIndex, rotationFirstData);
				//设置轮播图代码
				$('#rotation').html(rotationHtml);
				//设置page Control
				$('#pageControl').html(pageControlHtml(rotationArr.length));
				//设置自动轮播
				setupAutoRotation();
				$('#noRotation').hide();
				$('#rotation').show();
			}
			//		//设置轮播图点击事件
			setupRotationCellClick();
		}

		function setupAutoRotation() {
			var slider = mui("#train_slider");
			slider.slider({
				interval : 3000
			});
		}

		//分页html
		function pageControlHtml(count) {
			var pageControl = '';
			pageControl += '<div class="mui-indicator mui-active"></div>';
			for (var i = 1; i < count; i++) {
				pageControl += '<div class="mui-indicator"></div>';
			}
			return pageControl;
		}

		//轮播图首尾
		function firstLastImgHtml(index, data) {
			return '<div index="' + index + '" class="rotation-cell mui-slider-item mui-slider-item-duplicate">' + '<a href="#">' + '<img class="rotation-img" src="' + data.image + '">' + '</a>' + '</div>';
		}

		//轮播图
		function rotationHtmlString(index, data) {
			return '<div index="' + index + '" class="rotation-cell mui-slider-item">' + '<a href="#">' + '<img class="rotation-img" src="' + data.image + '">' + '</a>' + '</div>';
		}

		//不轮播的cell
		function noRotationHtmlString(index, data) {
			return '<div index="' + index + '" class="rotation-cell">' + '<img class="rotation-img" src="' + data.image + '">' + '</div>';
		}
	  function setupRotationCellClick() {
		$('.rotation-cell').unbind('click');
		$('.rotation-cell').click(function(event) {
			if (api.connectionType == "none") {
				api.toast({
					msg : '网络异常，请检查网络！'
				});
				return;
			}
			var index = $(this).attr('index');
			var rotationData = rotationArr[parseInt(index)];
			var url1 = rotationData.detail;
			if (url1 != '' && url1 != null && url1 != undefined) {
				if (url1.indexOf("http") == -1) {//包含

					return;
				}
				var pageParam =  {
				url: isfreelogin(rotationData.islogin,url1),
				title : rotationData.cname,
				}
			api.openWin({useWKWebView:true,
				name : 'indexLunDetailsWindow',
				url : '../HomePage/indexLunDetailsWindow.html',
				pageParam : pageParam
			});
			}

		});
	}
		function onclickwin(){
		    var sourceurl = window.location.pathname;
			var sourcetitle = document.title;
			var DataParam = {
				sourceurl : sourceurl,
				sourcetitle : sourcetitle
			};
			$('#qiandao').click(function() {
				api.openWin({useWKWebView:true,
					name : 'Student_dailyCheckWindow',
					url : 'Student_dailyCheckWindow.html',
					pageParam:DataParam
				});
				SendBehaviorTrajectoriesNotifi1('1', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			});
			$('#tijiaoDaily').click(function() {
				api.openWin({useWKWebView:true,
					name : 'Student_submitDaliyReportWindow',
					url : 'Student_submitDaliyReportWindow.html',
					pageParam:DataParam
				});
				SendBehaviorTrajectoriesNotifi1('1', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			});
			$('#tijiaoweekly').click(function() {
				api.openWin({useWKWebView:true,
					name : 'Student_submitWeeklyReportWindow',
					url : 'Student_submitWeeklyReportWindow.html',
					pageParam:DataParam
				});
				SendBehaviorTrajectoriesNotifi1('1', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			});
			$('#tijiaomonth').click(function() {
				api.openWin({useWKWebView:true,
					name : 'Student_submitMonthReportWindow',
					url : 'Student_submitMonthReportWindow.html',
					pageParam:DataParam
				});
				SendBehaviorTrajectoriesNotifi1('1', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			});
			$('#jieye').click(function() {
				api.openWin({useWKWebView:true,
					name : 'Student_completionReportWindow',
					url : 'Student_completionReportWindow.html',
					pageParam:DataParam
				});
				SendBehaviorTrajectoriesNotifi1('1', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			});
						//学生学习
			$('#learnid').click(function() {
				api.openWin({useWKWebView:true,
					name : 'Student_completionReportWindow',
					url : '../Practice_Student/Student_studyWindow.html',
					pageParam : DataParam
				});
				SendBehaviorTrajectoriesNotifi1('1', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			});
			//学生考试
			$('#testid').click(function() {
				api.openWin({useWKWebView:true,
					name : 'Student_completionReportWindow',
					url : '../Practice_Student/Practice_StudentExamWindow.html',
                   pageParam :  {
				sourceurl : sourceurl,
				sourcetitle : sourcetitle,
				openType : 'train_stu'
			     }
				});
			SendBehaviorTrajectoriesNotifi1('1', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			});
		}
	function  news(datas,len){
              
	      var news='';
	        for(var i=0;i<len;i++){
	           var data = datas[i];
	           var imgPath= data.img;
	           
		       var newhtml=	'<li class="mui-table-view-cell train-cell"  onclick="CheckClicks('+ data.type+','+data.istype+')">'+
					'<img class="hot-train-image" src="'+imgPath+'">'+
					'<div class="hot-train-title-div">'+
						'<p class="base_black_grey base_content_font train-title">'
							+escape2Html(data.desc).replace(/&/g,'')+
						'</p>'+
					'</div>'+
				'</li>';
			
				news = news+newhtml;
	        }
			   $("#div_news").html(news );

        }
       function  CheckClicks(type,istype){
      
       var winName="";
       var winUrl="";
      
       if(istype==0){//没考
	       if(type==4){
	          winName="Practice_Holland_EvaluationAnalysis"
	          winUrl=winName+'.html'
	       }else{
	          winName="Practice_EvaluationAnalysis"
	          winUrl=winName+'.html'
	       }
       }else{
           if(type==4){
	          winName="HolandeAnalysis_window"
	          winUrl="../Holander/HolandeAnalysis_window.html"
	       }else{
	          winName="Practice_EvaluationAnalysisScore"
	          winUrl=winName+'.html'
	       }
       
       
       }
      
          api.openWin({useWKWebView:true,
	          name: winName,
	          url: winUrl,
	          pageParam : {
	                sourceurl : window.location.pathname,
					sourcetitle : document.title,
					type: type,
					istype:istype//0:未参加 1:参加
				},
				reload:true,
          });
          
          SendBehaviorTrajectoriesNotifi1('1', '学生端实习首页', '157', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
       }
       //控制日报，周报的显示
       function customUI() {
			var opentype = $api.getStorage('cfnetppopentype');
			if (opentype == 1) {//日报
				$('#tijiaoweekly').hide();
				$('#tijiaoDaily').show();
			} else if (opentype == 0) {//周报
				$('#tijiaoweekly').show();
				$('#tijiaoDaily').hide();
			} else if (opentype == 2) {//日报周报都有
				$('#tijiaoweekly').show();
				$('#tijiaoDaily').show();
			}
		}
	</script>
</html>